<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: new_product.php 223 2013-09-22 10:20:27Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 223 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-09-22 10:20:27 +0000 (Sun, 22 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */
include(DIR_WS_MODULES.'additional_text.php');

if(($_GET['pID']) && (!$_POST)) {
	$product = $db->db_query("SELECT
									*
								FROM
									".TABLE_PRODUCTS." p
									LEFT JOIN ".TABLE_PRODUCTS_DESCRIPTION." pd USING (products_id)
								WHERE
									p.products_id = '".(int)$_GET['pID']."'
								AND
									pd.language_id = '".(int)$_SESSION['languages_id']."'");

	$pInfo = new objectInfo($product->fields);

} elseif ($_POST) {
	$pInfo = new objectInfo($_POST);
	$products_name = $_POST['products_name'];
	$products_description = $_POST['products_description'];
	$products_short_description = $_POST['products_short_description'];
	$products_keywords = $_POST['products_keywords'];
	$products_meta_title = $_POST['products_meta_title'];
	$products_meta_description = $_POST['products_meta_description'];
	$products_meta_keywords = $_POST['products_meta_keywords'];
	$products_tag_cloud = $_POST['$products_tag_cloud'];
	$products_url = $_POST['products_url'];
	$pInfo->products_startpage = $_POST['products_startpage'];
	$products_startpage_sort = $_POST['products_startpage_sort'];
	
} else
	$pInfo = new objectInfo(array());

$brand_array = array(array ('id' => '', 'text' => TEXT_NONE));
$brand = $db->db_query("SELECT
							brand_id,
							brand_name
						FROM
							".TABLE_BRAND."
						ORDER BY
							brand_name");

while(!$brand->EOF) {
	$brand_array[] = array('id' => $brand->fields['brand_id'], 'text' => $brand->fields['brand_name']);
	$brand->MoveNext();
}
$vpe_array = array(array('id' => '', 'text' => TEXT_NONE));
$vpe = $db->db_query("SELECT
							products_vpe_id,
							products_vpe_name
						FROM
							".TABLE_PRODUCTS_VPE."
						WHERE
							language_id='".$_SESSION['languages_id']."'
						ORDER BY
							products_vpe_name");
while(!$vpe->EOF) {
	$vpe_array[] = array('id' => $vpe->fields['products_vpe_id'], 'text' => $vpe->fields['products_vpe_name']);
	$vpe->MoveNext();
}

$tax_class_array = array(array ('id' => '0', 'text' => TEXT_NONE));
$tax_class = $db->db_query("SELECT
								tax_class_id,
								tax_class_title
							FROM
								".TABLE_TAX_CLASS."
							ORDER BY
								tax_class_title");
while(!$tax_class->EOF) {
	$tax_class_array[] = array('id' => $tax_class->fields['tax_class_id'], 
								'text' => $tax_class->fields['tax_class_title']);
	$tax_class->MoveNext();
}
$conditions = array(array ('id' => 'neu', 'text' => 'Neu'));
$conditions[] = array('id' => 'gebraucht', 'text' => 'Gebraucht');
$conditions[] = array('id' => 'erneuert', 'text' => 'Erneuert');

$usk = array(array ('id' => '', 'text' => ' keine Grafik '));
$usk[] = array('id' => '0', 'text' => 'USK 0');
$usk[] = array('id' => '6', 'text' => 'USK 6');
$usk[] = array('id' => '12', 'text' => 'USK 12');
$usk[] = array('id' => '16', 'text' => 'USK 16');
$usk[] = array('id' => '18', 'text' => 'USK 18');

$shipping_statuses = array ();
$shipping_statuses = get_shipping_status();
$languages = get_languages();

?>
<tr class="products_data dn">
	<td>
		<table class="table_pageHeading" border="0" width="100%" cellspacing="0" cellpadding="0">
			<tr>
				<td class="pageHeading">
					<?php 
						if(isset($_GET['pID']) && !empty($_GET['pID']))
							echo sprintf(TEXT_EDIT_PRODUCT, get_products_name($pInfo->products_id, $_SESSION['languages_id']), output_generated_category_path($current_category_id));
						else
							echo sprintf(TEXT_NEW_PRODUCT, output_generated_category_path($current_category_id)); 
					?>
				</td>
			</tr>
		</table>
		<?php
		$form_action = (isset($_GET['pID'])) ? 'update_product' : 'insert_product';

		if(isset($_GET['pID']) && !empty($_GET['pID']))
			$params = '&pID='.$_GET['pID'];

		echo draw_form('new_product', FILENAME_CATEGORIES, 'cPath='.$_GET['cPath'].'&action='.$form_action.$params, 'POST', 'enctype="multipart/form-data"').draw_hidden_field('products_id', $pInfo->products_id); ?>
		<input type="hidden" name="selected_tab" id="hidden_tab" />
		<div align="right" style="display:block; text-align:right">
			<button type="submit" name="save_new_product" class="button" value="">
				<span class="button_disk-black">
					<?php echo BUTTON_SAVE; ?>
				</span>
			</button>
			<?php if(isset($_GET['pID'])) { ?>
			<button type="submit" name="apply_new_product_mi" class="button" value="">
				<?php echo BUTTON_APPLY; ?>
			</button>
			<?php } else { ?>
			<button type="submit" name="apply_new_product_oi" class="button" value="">
				<?php echo BUTTON_APPLY; ?>
			</button>
			<?php } ?>
			<button type="submit" name="save_new_product_and_more" class="button" value="">
				<span class="button_disk--plus-black">
					<?php echo BUTTON_SAVE_PROD_AND_AGAIN; ?>
				</span>
			</button>
			<button type="button" class="button" onclick="window.location.href='<?php echo href_link(FILENAME_CATEGORIES, 'cPath='.$cPath.(isset($_GET['pID'])?'&pID='.$_GET['pID']:'')); ?>'">
				<span class="button_door-open-in-black">
					<?php echo BUTTON_CLOSE; ?>
				</span>
			</button>
		</div>
		<div id="config">
			<ul>
				<li><a href="#misc" onclick="return false"><?php echo TEXT_TAB_1; ?></a></li>
				<li><a href="#desc" onclick="return false"><?php echo TEXT_TAB_2; ?></a></li>
				<li><a href="#img" onclick="return false"><?php echo TEXT_TAB_3; ?></a></li>
				<li><a href="#attr" onclick="return false"><?php echo TEXT_TAB_4; ?></a></li>
				<li><a href="#filt" onclick="return false"><?php echo TEXT_TAB_5; ?></a></li>
				<li><a href="#google" onclick="return false">Google</a></li>
				<?php
					if(TREEPODIA_STATUS == 'true')
						echo '<li><a href="#treep">Treepodia</a></li>';
				?>
			</ul>
			<div id="misc">
				<table width="100%">
					<tr>
						<td width="50%" valign="top">
							<div id="product_misc_left">
								<h3><a href="#"><?php echo TEXT_GENERAL_HEAD ?></a></h3>
								<div>
									<table width="100%">
										<tr>
											<td class="main" align="right" width="50%" valign="top">
												<?php echo IN_WICH_CATEGORIES ?><br />
												<button type="button" class="button" class="one_more_link_cat" onclick="xajax_linkCategory(); return false;">
													mehr Kategorien
												</button>
											</td>
											<td class="main" id="one_more_link_cat_target" valign="top"></td>
										</tr>
										<tr>
											<td class="main" align="right">
												<?php echo TEXT_PRODUCTS_ACTIVE ?> 
											</td>
											<td class="main">
												<?php echo draw_radio_field_jq('products_status', array(1 => array('1', YES), 0 => array('0', NO)), $pInfo->products_status || !isset($_GET['pID']) ? '1' : '0'); ?>
											</td>
										</tr>
										<?php
											if (GROUP_CHECK == 'true') {
												$customers_statuses_array = get_customers_statuses();
												$customers_statuses_array = array_merge(array (array ('id' => 'all', 'text' => TXT_ALL)), $customers_statuses_array);
										?>
										<tr>
											<td class="main" valign="top" align="right">
												<?php echo ENTRY_CUSTOMERS_STATUS; ?>
											</td>
											<td class="main" valign="top">
												<?php
													for ($i = 0; $n = sizeof($customers_statuses_array), $i < $n; $i ++) {
														$code = '$id=$pInfo->group_permission_'.$customers_statuses_array[$i]['id'].';';
														eval ($code);
														if ($id==1)	$checked = 'checked ';
														else $checked = '';
														echo '<input type="checkbox" name="groups[]" value="'.$customers_statuses_array[$i]['id'].'"'.$checked.' /> '.$customers_statuses_array[$i]['text'].'<br />';
													}
												?>
											</td>
										</tr>
										<?php } ?>
										<tr>
											<td class="main" align="right">
												<?php echo TEXT_PRODUCTS_LIST_OVERLAY ?>
											</td>
											<td class="main">
												<?php echo draw_selection_field('products_list_overlay', 'checkbox', '1', (!isset($_GET['pID']) ? (GLOBAL_PRODUCTS_OVERLAY == 1 ? true : false) : $pInfo->products_list_overlay==1 ? true : false)); ?>
											</td>
										</tr>
										<tr>
											<td class="main" align="right">
												<?php echo TEXT_PRODUCTS_STARTPAGE; ?> 
											</td>
											<td class="main">	
												<?php echo draw_selection_field('products_startpage', 'checkbox', '1', $pInfo->products_startpage==1 ? true : false); ?>
											</td>
										</tr>
										<tr>
											<td class="main" align="right">
												<?php echo TEXT_PRODUCTS_STARTPAGE_SORT; ?>
											</td>
											<td class="main">	
												<?php echo  draw_input_field('products_startpage_sort', $pInfo->products_startpage_sort ,'size=3'); ?>
											</td>
										</tr>
										<tr>
											<td class="main" align="right">
												<?php echo TEXT_PRODUCTS_SORT; ?> 
											</td>
											<td class="main">	
												<?php echo  draw_input_field('products_sort', $pInfo->products_sort,'size=3'); ?>
											</td>
										</tr>
										<tr>
											<td class="main" align="right">
												<?php echo TEXT_PRODUCTS_QUANTITY; ?>
											</td>
											<td class="main">	
												<?php echo draw_input_field('products_quantity', $pInfo->products_quantity,'size=5'.($pInfo->products_quantity < 1 ? ' style="border-color:#b20000;color:#b20000;text-align:center"':' style="text-align:center"')); ?>
											</td>
										</tr>
										<tr>
											<td class="main" align="right">
												<?php echo TEXT_PRODUCTS_BRAND; ?>
											</td>
											<td class="main">	
												<?php echo draw_pull_down_menu('brand_id', $brand_array, $pInfo->brand_id); ?>
											</td>
										</tr>
										<tr>
											<td class="main" align="right">
												<?php echo TEXT_PRODUCTS_MODEL; ?>
											</td>
											<td class="main">	
												<?php echo  draw_input_field('products_model', $pInfo->products_model); ?>
											</td>
										</tr>
										<tr>
											<td class="main" align="right">
												<?php echo TEXT_PRODUCTS_EAN; ?>
											</td>
											<td class="main">	
												<?php echo  draw_input_field('products_ean', $pInfo->products_ean); ?>
											</td>
										</tr>
										<tr>
											<td class="main" align="right">
												ISBN: 
											</td>
											<td class="main">	
												<?php echo draw_input_field('products_isbn', $pInfo->products_isbn); ?>
											</td>
										</tr>
										<tr>
											<td class="main" align="right">
												<?php echo TEXT_PRODUCTS_VPE_VISIBLE ?>
											</td>
											<td class="main">	
												<?php echo draw_selection_field('products_vpe_status', 'checkbox', '1',$pInfo->products_vpe_status==1 ? true : false); ?>
										</tr>
										<tr>
											<td class="main" align="right">
												<?php echo TEXT_PRODUCTS_VPE_VALUE ?>
											</td>
											<td class="main">
												<?php echo draw_input_field('products_vpe_value', $pInfo->products_vpe_value, 'size=5'); ?>
											</td>
										</tr>
										<tr>
											<td class="main" align="right">
												<?php echo TEXT_PRODUCTS_VPE?>
											</td>
											<td class="main">	
												<?php echo draw_pull_down_menu('products_vpe', $vpe_array, $pInfo->products_vpe='' ?  DEFAULT_PRODUCTS_VPE_ID : $pInfo->products_vpe); ?>
											</td>
										</tr>
										<tr>
											<td class="main" align="right">
												<?php echo TEXT_FSK18; ?>
											</td>
											<td class="main fsk_td">
												<?php echo draw_radio_field_jq('products_fsk18', array(1 => array('1', YES), 0 => array('0', NO)), $pInfo->products_fsk18 || (!isset($_GET['pID']) ? '0' : $pInfo->products_fsk18)); ?><br />
												<?php 
													echo draw_pull_down_menu('products_usk', $usk, $pInfo->products_usk, 'class="usk_dropdown dn"');
												?>
											</td>
										</tr>
										<tr>
											<td class="main" align="right">
												<?php echo TEXT_PRODUCTS_WEIGHT; ?>
											</td>
											<td class="main">	
												<?php echo draw_input_field('products_weight', $pInfo->products_weight,'size=4'); ?><?php echo TEXT_PRODUCTS_WEIGHT_INFO; ?>
											</td>
										</tr>
									</table>
								</div>
								<h3><a href="#"><?php echo TEXT_PRESENTATION_HEAD ?></a></h3>
								<div>
									<table width="100%">
										<tr>
											<td class="main" align="right" width="50%">
												<?php echo TEXT_TELL_A_FRIEND; ?>
											</td>
											<td class="main">	
												<?php echo draw_selection_field('products_tell_a_friend', 'checkbox', '1', (!isset($_GET['pID']) ? (GLOBAL_PRODUCTS_TELL == 1 ? true : false) : ($pInfo->products_tell_a_friend==1 ? true : false))); ?>
											</td>
										</tr>
										<tr>
											<td class="main" align="right">
												<?php echo TEXT_ASK_TO_PRODUCT; ?>
											</td>
											<td class="main">
												<?php echo draw_selection_field('products_ask_to_product', 'checkbox', '1', (!isset($_GET['pID']) ? (GLOBAL_PRODUCTS_ASK == 1 ? true : false) : ($pInfo->products_ask_to_product==1 ? true : false))); ?>
											</td>
										</tr>
										<tr>
											<?php
											$files = array ();
											if ($dir = opendir(DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/module/product_info/')) {
												while (($file = readdir($dir)) !== false) {
													if (is_file(DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/module/product_info/'.$file) && ($file != "index.html"))
														$files[] = array('id' => $file, 'text' => $file);
												}
												closedir($dir);
											}											
											echo '<td class="main" align="right">'.TEXT_CHOOSE_INFO_TEMPLATE.':</td>';
											echo '<td class="main">'.draw_pull_down_menu('info_template', $files, $pInfo->product_template).'</td>';
											?>
										</tr>
										<tr>
										<?php
											$files = array();
											if ($dir = opendir(DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/module/product_options/')) {
												while (($file = readdir($dir)) !== false)
													if (is_file(DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/module/product_options/'.$file) and ($file != "index.html"))
														$files[] = array ('id' => $file, 'text' => $file);
												closedir($dir);
											}
											echo '<td class="main" align="right">'.TEXT_CHOOSE_OPTIONS_TEMPLATE.':'.'</td>';
											echo '<td class="main">'.draw_pull_down_menu('options_template', $files, $pInfo->options_template).' '.get_help(31, 'Optionsvorlagen').'</td>';
											?>
										</tr>
										<tr>
											<td class="main" valign="top" align="right">
												<?php echo TEXT_SHOW_COLUMNS ?>
											</td>
											<td class="main">
												<?php
													if(isset($_GET['pID'])) {
														echo draw_selection_field('products_col_top', 'checkbox', '1', $pInfo->products_col_top==1 ? true : false).' oben<br />';
														echo draw_selection_field('products_col_left', 'checkbox', '1', $pInfo->products_col_left==1 ? true : false).' links<br />';
														echo draw_selection_field('products_col_right', 'checkbox', '1', $pInfo->products_col_right==1 ? true : false).' rechts<br />';
														echo draw_selection_field('products_col_bottom', 'checkbox', '1', $pInfo->products_col_bottom==1 ? true : false).' unten<br />';
													} else {
														echo draw_selection_field('products_col_top', 'checkbox', '1', (GLOBAL_COLUMN_TOP == 1 ? true : false)).' oben<br />';
														echo draw_selection_field('products_col_left', 'checkbox', '1', (GLOBAL_COLUMN_LEFT == 1 ? true : false)).' links<br />';
														echo draw_selection_field('products_col_right', 'checkbox', '1', (GLOBAL_COLUMN_RIGHT == 1 ? true : false)).' rechts<br />';
														echo draw_selection_field('products_col_bottom', 'checkbox', '1', (GLOBAL_COLUMN_BOTTOM == 1 ? true : false)).' unten<br />';
													}
												?>
											</td>
										</tr>
										<tr>
											<td class="main" valign="top" align="right">
												<?php echo TEXT_PRODUCTS_INFO; ?>
											</td>
											<td class="main">
												<?php echo draw_radio_field('products_info', 'plain', ($pInfo->products_info == 'plain' || (!isset($_GET['pID']) && GLOBAL_PRODUCTS_SITE == 'plain') ? true : false)); ?> "einfache" Auflistung<br />
												<?php echo draw_radio_field('products_info', 'tabs', ($pInfo->products_info == 'tabs' || (!isset($_GET['pID']) && GLOBAL_PRODUCTS_SITE == 'tabs') ? true : false)) ?> Tabs<br />
												<?php echo draw_radio_field('products_info', 'accordion', ($pInfo->products_info == 'accordion' || (!isset($_GET['pID']) && GLOBAL_PRODUCTS_SITE == 'accordion') ? true : false)) ?> Accordion<br />
											</td>
										</tr>
									</table>
								</div>
							</div>
						</td>
						<td valign="top" style="padding-left:10px">						
							<div id="product_misc_right">
								<h3><a href="#"><?php echo TEXT_PRICE_HEAD ?></a></h3>
								<div>
									<?php include(DIR_WS_MODULES.'group_prices.php'); ?>
								</div>
								<h3><a href="#"><?php echo TEXT_STOCK_HEAD ?></a></h3>
								<div>	
									<table width="100%">
										<tr>
											<td class="main" align="right">
												<?php echo TEXT_PRODUCTS_STATUS; ?>
											</td>
											<td class="main">
												<?php echo draw_radio_field_jq('products_stock', array(1 => array('1', TEXT_PRODUCT_AVAILABLE), 0 => array('0', TEXT_PRODUCT_NOT_AVAILABLE)), $pInfo->products_stock || !isset($_GET['pID']) ? '1' : '0'); ?>
											</td>
										</tr>
										<tr>
											<td class="main" align="right"><?php echo TEXT_PRODUCTS_DATE_AVAILABLE; ?></td>
											<td class="main">
												<input type="text" name="products_date_available" class="date_available" value="<?php echo ($pInfo->products_date_available != '0000-00-00 00:00:00' ? $pInfo->products_date_available : ''); ?>" />
												<script type="text/javascript">
													$(function(){$('.date_available').datetimepicker({minDate:new Date(<?php echo date('Y').','.date('m').'-1,'.date('d'); ?>),buttonImage:"includes/javascript/ui/images/calendar.png",showOn:"button",dateFormat:'yy-mm-dd',showSecond:true,timeFormat:'hh:mm:ss',stepMinute:10,stepSecond:10});});
												</script>
											</td>
										</tr>
										<?php if (ACTIVATE_SHIPPING_STATUS == 'true') { ?>
											<tr>
												<td class="main" align="right"><?php echo BOX_SHIPPING_STATUS.':'; ?></td>
												<td class="main"><?php echo draw_pull_down_menu('shipping_status', $shipping_statuses, $pInfo->products_shippingtime); ?></td>
											</tr>
										<?php } ?>
										<tr>
											<td class="main" align="right"><?php echo TEXT_PRODUCTS_CONDITION ?></td>
											<td class="main"><?php echo draw_pull_down_menu('products_zustand', $conditions, $pInfo->products_zustand); ?></td>
										</tr>
										<tr>
											<td class="main" align="right">
												<?php echo TEXT_SET_CONTENT_ID ?>
											</td>
											<td class="main">
												<select name="products_content_id">
													<?php echo str_replace('Top', '--', contentTree(0, $pInfo->products_content_id)); ?>
												</select>
											</td>
										</tr>
									</table>
								</div>
							</div>
						</td>
					</tr>
				</table>
			</div>
			<div id="desc">
				<div id="tabs">
					<ul>
						<?php 
            for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { ?>
							<li><a href="#language_<?php echo $languages[$i]['id']; ?>">
								<span><img src="../lang/<?php echo $languages[$i]['directory'].'/'.$languages[$i]['image']; ?>" alt="" /> <?php echo $languages[$i]['name'] ?></span>
							</a></li>
						<?php } ?>
					</ul>
					<?php for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { ?> 
						<div id="language_<?php echo $languages[$i]['id'] ?>">
							<table width="100%" border="0">
								<tr>
									<td width="50%" valign="top">
										<table width="100%" border="0">
										  <tr>
											<td style="background:#e2e2e2" valign="top" class="main"><?php echo image(DIR_WS_LANGUAGES.$languages[$i]['directory'] .'/'. $languages[$i]['image'], $languages[$i]['name']); ?>&nbsp;<?php echo TEXT_PRODUCTS_NAME; ?> <?php echo draw_input_field('products_name['.$languages[$i]['id'].']', (($products_name[$languages[$i]['id']]) ? stripslashes($products_name[$languages[$i]['id']]) : get_products_name($pInfo->products_id, $languages[$i]['id'])),'style="width:98%"'); ?></td>
										  </tr>
										  <tr>
											<td style="background:#fafafa" valign="top" class="main"><?php echo image(DIR_WS_LANGUAGES.$languages[$i]['directory'] .'/'. $languages[$i]['image'], $languages[$i]['name']); ?>&nbsp;URL Alias<em>(optional)</em> <?php echo ' <a href="#" onclick="javascript:return false;"'.mouseOverJS(HEAD_URL_ALIAS,BODY_URL_ALIAS).'>'.image(DIR_WS_ICONS.'icon_help.gif').'</a>';  ?>: <?php echo draw_input_field('products_url_alias['.$languages[$i]['id'].']', (($products_url_alias[$languages[$i]['id']]) ? stripslashes($products_url_alias[$languages[$i]['id']]) : get_products_url_alias($pInfo->products_id, $languages[$i]['id'])),'style="width:98%"'); ?></td>
										  </tr>
										  <tr>
											<td class="main"><?php echo TEXT_PRODUCTS_URL.' <a href="#" onclick="javascript:return false;"'.mouseOverJS(TEXT_PRODUCTS_URL,TEXT_PRODUCTS_URL_WITHOUT_HTTP).'>'.image(DIR_WS_ICONS.'icon_help.gif').'</a>'; echo draw_input_field('products_url['.$languages[$i]['id'].']', (($products_url[$languages[$i]['id']]) ? stripslashes($products_url[$languages[$i]['id']]) : get_products_url($pInfo->products_id, $languages[$i]['id'])),'style="width:98%"0') ?></td>
										  </tr>
										</table>
									</td>
									<td valign="top" align="right" >
										<table width="80%">
											<tr>
												<td valign="top" class="main">
											<?php echo TEXT_PRODUCTS_KEYWORDS; ?><br />
											<?php echo draw_input_field('products_keywords['.$languages[$i]['id'].']',(($products_keywords[$languages[$i]['id']]) ? stripslashes($products_keywords[$languages[$i]['id']]) : get_products_keywords($pInfo->products_id, $languages[$i]['id'])), 'style="width:98%"'); ?><br />
											<?php echo TEXT_META_TITLE; ?><br />
											<?php echo draw_input_field('products_meta_title['.$languages[$i]['id'].']',(($products_meta_title[$languages[$i]['id']]) ? stripslashes($products_meta_title[$languages[$i]['id']]) : get_products_meta_title($pInfo->products_id, $languages[$i]['id'])), 'style="width:98%"'); ?><br />
											<?php echo TEXT_META_DESCRIPTION; ?><br />
											<?php echo draw_input_field('products_meta_description['.$languages[$i]['id'].']',(($products_meta_description[$languages[$i]['id']]) ? stripslashes($products_meta_description[$languages[$i]['id']]) : get_products_meta_description($pInfo->products_id, $languages[$i]['id'])), 'style="width:98%"'); ?><br />
											<?php echo TEXT_META_KEYWORDS; ?><br />
											<?php echo draw_input_field('products_meta_keywords['.$languages[$i]['id'].']', (($products_meta_keywords[$languages[$i]['id']]) ? stripslashes($products_meta_keywords[$languages[$i]['id']]) : get_products_meta_keywords($pInfo->products_id, $languages[$i]['id'])), 'style="width:98%"'); ?> <br />
											<script type="text/javascript">
											  	<!--
												$(function(){
													$('a.ajax_<?php echo $languages[$i]['id'] ?>').click(function(){
														var input = '<input type="text" style="width:98%" name="products_tag_cloud[<?php echo $languages[$i]['id'] ?>][]" />';
														$('#quote_<?php echo $languages[$i]['id'] ?>').append(input);
														return false;
													});
												});
												//-->
											</script>
											Tag Cloud <?php echo get_help(8, 'Tag-Cloud'); ?>
											
											<br />
											<?php
												$data = $db->db_query("SELECT tag FROM ".TABLE_TAG_TO_PRODUCT." WHERE lID = '".$languages[$i]['id']."' AND pID = '".$pInfo->products_id."' ");
												if($data->_numOfRows) {
													while(!$data->EOF) {
														if(!empty($data)) {
															$Tag_nr = rand(1, 100000);
															echo '<div style="position:relative" id="cont_'.$Tag_nr.'">'.draw_input_field('products_tag_cloud['.$languages[$i]['id'].'][]', $data->fields['tag'], 'style="width:98%" id="tag_'.$Tag_nr.'" onkeyup="xajax_searchDB(this.value, '.$Tag_nr.')" autocomplete="off"').'<div class="tag_treffer" id="list_'.$Tag_nr.'"></div></div>';
														}
														$data->MoveNext();
													}
												} else {
													$Tag_nr = rand(1, 100000);
													echo '<div style="position:relative" id="cont_'.$Tag_nr.'">'.draw_input_field('products_tag_cloud['.$languages[$i]['id'].'][]', '', 'style="width:98%" id="tag_'.$Tag_nr.'" onkeyup="xajax_searchDB(this.value, '.$Tag_nr.')" autocomplete="off"').'<div class="tag_treffer" id="list_'.$Tag_nr.'"></div></div>';
												}
											?>
											<div id="quote_<?php echo $languages[$i]['id'] ?>"></div>
											<a class="ajax_<?php echo $languages[$i]['id'] ?>" href="#">weiteres Feld hinzuf&uuml;gen</a>
										 </td>
										</tr>
									   </table>
									</td>
								</tr>
							</table>
							<table width="100%" border="0">
							  <tr>
								<td>
									<h2><?php echo TEXT_PRODUCTS_DESCRIPTION; ?></h2>
									<textarea name="products_description_<?php echo $languages[$i]['id'] ?>" id="products_description_<?php echo $languages[$i]['id'] ?>"><?php echo (($products_description[$languages[$i]['id']]) ? stripslashes($products_description[$languages[$i]['id']]) : get_products_description($pInfo->products_id, $languages[$i]['id']))?></textarea>
								</td>
								</tr>
							  </table>
							  <table border="0" width="100%" style="margin-top: 10px">
							  <tr>
								<td valign="top" style="border-top: 1px solid #ccc">
									<h2><?php echo TEXT_PRODUCTS_SHORT_DESCRIPTION; ?></h2>
									<textarea name="products_short_description_<?php echo $languages[$i]['id'] ?>" id="products_short_description_<?php echo $languages[$i]['id'] ?>"><?php echo (($products_short_description[$languages[$i]['id']]) ? stripslashes($products_short_description[$languages[$i]['id']]) : get_products_short_description($pInfo->products_id, $languages[$i]['id'])) ?></textarea>
							   </td>
							  </tr>
							</table><br />
							<?php 
								echo getAdditionals($pInfo->products_id, $languages[$i]['id']);
							?>
						</div>
					<?php $ii++; } ?>
				</div>
			</div>
			<div id="img">
				<table width="100%" border="0">
					<tr>
						<td width="49%" valign="top">
							<?php include (DIR_WS_MODULES.'products_images.php'); ?>
						</td>
						<td width="1%">
							&nbsp;
						</td>
						<td valign="top">
							<?php if(!empty($pInfo->products_id)) { ?>
								<button class="button" type="button" onclick="xajax_openInputForUrl(<?php echo $pInfo->products_id ?>)">
									Grafik via URL holen
								</button>
							<?php } ?>
							<div class="header">Flash</div>
							<table width="100%" border="0" cellpadding="3">
								<tr>
									<td class="main" valign="top">
										Flash URL:<br />
										unterstützt werden Links von:
										Vimeo, Youtube, youtu.be und MyVideo
									</td>
									<td class="main">
										<?php echo  draw_input_field('products_movie_url', $pInfo->products_movie_url,'style="width:99.5%"'); ?><br />
										<span style="font-size:85%"><i>http://www.youtube.com/watch?v=xxxxxxxx</i><br/> oder <i>http://vimeo.com/xxxxxx</i><br /> oder <i>http://www.myvideo.de/watch/xxxxxxx/</i></span>
									</td>
								</tr>
							</table>
							<span class="upload_queue"></span>
						</td>
					<tr>
				</table>
			</div>
			<div id="attr">
				<?php include(DIR_WS_MODULES.'attribut_manager.php'); ?>
			</div>
			<div id="filt">
				<?php include(DIR_WS_MODULES.'products_filters.php'); ?>
			</div>
			<div id="google">
				<?php include (DIR_WS_MODULES.'google_taxonomy.php'); ?>
			</div>
			<?php if(TREEPODIA_STATUS == 'true') include(DIR_WS_MODULES.'treepodia.php'); ?>
		</div>
		<?php
			echo draw_hidden_field('products_date_added', (($pInfo->products_date_added) ? $pInfo->products_date_added : date('Y-m-d')));
			echo draw_hidden_field('products_id', $pInfo->products_id);
		?>
		<input type="hidden" name="" value="0" id="additional_counter" />
		</form>
		<div title="<?php echo TEXT_PRODUCTS_ADDITIONAL ?>" id="dialog_box" style="display:none"></div>
		<script type="text/javascript" src="includes/javascript/new_product.js.php?l=<?php echo $_SESSION['language_code'] ?>&pid=<?php echo $pInfo->products_id ?>"></script>
	</td>
</tr>